 $(document).ready(function() {
	var bgImageTotal=2;
 	var randomNumber = Math.round(Math.random()*(bgImageTotal-1))+1;
 	var imgPath=('front-random-'+randomNumber);
 	$(".front-welcome").addClass(imgPath);

	$("#pass_login_input_submit").click(function() {
		var errorMsg ;
		var obj = swfobject.getObjectById("preload");
		var uid = $("#pass_login_username").val();
		var pass = $("#pass_login_password").val();
		if(uid=="") {
			errorMsg = "请输入登录邮箱";
			loginFail(errorMsg);
		}else if(pass==""){
			errorMsg = "请输入确认密码";
			loginFail(errorMsg);
		}else{
			disableSubmitBtn();
			var paras = {id:uid,pass:pass,version:Game.versionstr,logoBarId:'logoBar1.png'};
			obj.loginFunc(paras);
		}
	});
 });

 function showConnectSuc(){
	 enableSubmitBtn();
 }

 function disableSubmitBtn(){
	$("#pass_login_input_submit").removeClass("pass_login_submit_default");
	$("#pass_login_input_submit").addClass("pass_login_submit_disable");
	$("#pass_login_input_submit").attr("value","加载中...");
	$("#pass_login_input_submit").attr("disabled","disabled"); 
 }

 function enableSubmitBtn(){
	$("#pass_login_input_submit").removeClass("pass_login_submit_disable");
	$("#pass_login_input_submit").addClass("pass_login_submit_default");
	$("#pass_login_input_submit").attr("value","登录");
	$("#pass_login_input_submit").removeAttr("disabled");
 }


 function loadMainPage(){
	$("#content").fadeOut("fast",function(){
		$(this).empty();
		$("body").css({ backgroundColor: "#cccccc",textAlign:"center"});
		$("#doc").addClass("route-front");
		var obj = swfobject.getObjectById("preload");
		$(obj).css({ width: "790", height: "570", visibility:"visible" });
		//obj.createCSS("#preload", "visibility:visible;width:790;height:570;");
		//swfobject.createCSS("#preload", "display:block;text-align:left;");
		$(obj).fadeIn("normal");
		});
 }

 function login360(){
	
 }

   function loginFail(errorMsg){
	enableSubmitBtn();
	$("#pass_login_generalerror").replaceWith("<span id='pass_login_generalerror' class='pass_login_generalerror'>"+errorMsg+"</span>");
 }